package com.jysz.certificate.persistence.enums;
/**
 *
 * @author xuxiaolong
 */
public enum WorkflowState {
	NOTSTART("暂存", 0), SUBMITED("待审核", 1), REFUSED("已退回", 2), PASS("已通过",3), FINISH("已完成", 4);
	   
    //名称
    private String name;
    //索引
    private int index;   
    private WorkflowState(String name, int index) {   
        this.name = name;   
        this.index = index;   
    }   
    
    //根据索引获得名称
    public static String getName(int index) {   
        for (WorkflowState w : WorkflowState.values()) {   
            if (w.getIndex() == index) {   
                return w.name;   
            }   
        }   
        return null;   
    }
    //根据索引获得枚举
    public static WorkflowState index(int index) {   
    	for (WorkflowState w : WorkflowState.values()) {   
    		if (w.getIndex() == index) {   
    			return w;   
    		}   
    	}   
    	return null;   
    }
    
    public String getName() {   
        return name;   
    }   
    public void setName(String name) {   
        this.name = name;   
    }   
    public int getIndex() {   
        return index;   
    }   
    public void setIndex(int index) {   
        this.index = index;   
    }   
    
    public static boolean isCanDelete(WorkflowState workflowState){
    	return true;
//		return NOTSTART.equals(workflowState) || REFUSED.equals(workflowState) || SUBMITED.equals(workflowState);
    }

}
